/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package guiexample;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

class TankController implements KeyListener, MouseListener, MouseMotionListener {
    private Tank tank = null;
    private TankView view = null;
    static int mouseX = 0;
    static int mouseY = 0;
    public void keyTyped(KeyEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void keyPressed(KeyEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
        int key = e.getKeyCode();
        if(key == KeyEvent.VK_DOWN){
            tank.setY(tank.getY() + 3);
        }
        else if(key == KeyEvent.VK_UP){
            tank.setY(tank.getY() - 3);
        }
        else if(key == KeyEvent.VK_LEFT){
            tank.setX(tank.getX() - 3 );
        }
        else if(key == KeyEvent.VK_RIGHT){
            tank.setX(tank.getX() + 3);
        }
    }

    public void keyReleased(KeyEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseClicked(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mousePressed(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseReleased(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseEntered(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseExited(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * @return the tank
     */
    public Tank getTank() {
        return tank;
    }

    /**
     * @param tank the tank to set
     */
    public void setTank(Tank tank) {
        this.tank = tank;
    }

    /**
     * @return the view
     */
    public TankView getView() {
        return view;
    }

    /**
     * @param view the view to set
     */
    public void setView(TankView view) {
        this.view = view;
    }

    public void mouseDragged(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseMoved(MouseEvent e) {
        mouseX = e.getX();
        mouseY = e.getY();
        //throw new UnsupportedOperationException("Not supported yet.");
    }



}
